package Exer03_分支;

import java.util.Scanner;

public class _1_3_10_按位输出数字 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个整数");
        int num = scanner.nextInt();
        int myriad,thousand,hundred,ten,individual;
        if (num >= 10000 && num <= 99999 ){
            myriad = (num%100000)/10000;
            thousand = (num%10000)/1000;
            hundred = (num%1000)/100;
            ten = (num%100)/10;
            individual = num%10;
            System.out.println("万位：" + myriad +"\n"+ "千位：" + thousand +"\n"+ "百位："+hundred +"\n"+ "十位："+ten+"\n"+ "个位：" + individual);
        } else if (num >= 1000 && num <= 9999) {
            thousand = (num%10000)/1000;
            hundred = (num%1000)/100;
            ten = (num%100)/10;
            individual = num%10;
            System.out.println("千位：" + thousand +"\n"+ "百位："+hundred +"\n"+ "十位："+ten+"\n"+ "个位：" + individual);
        }else if (num >= 100 && num <= 999) {
            hundred = (num%1000)/100;
            ten = (num%100)/10;
            individual = num%10;
            System.out.println("百位："+hundred +"\n"+ "十位："+ten+"\n"+ "个位：" + individual);
        }else if (num >= 10 && num <= 99) {
            ten = (num%100)/10;
            individual = num%10;
            System.out.println("十位："+ten+"\n"+ "个位：" + individual);
        }else if (num >= 0 && num <= 9) {
            individual = num%10;
            System.out.println("个位：" + individual);
        }
        scanner.close();
    }
}
